using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using MCromwell.StaffIntranet.Presenters;
using MCromwell.StaffIntranet.DTO;

namespace MCromwell.StaffIntranet.UI
{
    public partial class Logout : Page, ILogoutView
    {
        private LogoutPresenter presenter;

        protected void Page_Load(object sender, EventArgs e)
        {
            InitializePresenter();
            presenter.Logout(LoginManager.RetrieveCurrentSessionIdentifer());
        }

        private void InitializePresenter()
        {
            presenter = new LogoutPresenter(this);
        }

        public void Display(NotificationDTO notification)
        {
            if (notification.ErrorExists("user_not_logged_in"))
                lblMessage.Text = notification.GetError("user_not_logged_in").Message;
            else if (notification.InfoExists("user_logged_out"))
                lblMessage.Text = notification.GetInfo("user_logged_out").Message;
        }
    }
}
